// 获取
const getCookie = (name) => {
    var arr = document.cookie.match(new RegExp('(^| )' + name + '=([^;]*)(;|$)'))
    if (arr != null && decodeURI(arr[2]) != '') return decodeURI(arr[2])
    return ''
  }

  // 存储 删除token
const setCookie = (cname, cvalue, exdays, path = null) => {
    let d = new Date()
    d.setTime(d.getTime() + exdays * 24 * 60 * 60 * 1000)
    var expires = 'expires=' + d.toUTCString()
    console.info(cname + '=' + cvalue + '; ' + expires)
    let str = cname + '=' + cvalue + '; ' + expires
    path && (str += ';path=/')
    document.cookie = str
  }
export {getCookie,setCookie}